/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package MetricsRetriever;

import General.Globals;
import java.util.ArrayList;

/**
 *
 * @author Manuel
 */
public class Project {

    private String name;
    private String description;
    private String url;
    private String forge;
    private ArrayList<String> labels;
    private ArrayList<String> languages;
    private ArrayList<String> collaborators;
    private int activity;
    private int noOfClasses;
    private ProjectPackage firstCodePackage;
    private String byteDirectory;
    private String sourceDirectory;
    private ArrayList repositoryHistory;
    private int repositoryType;
    private ArrayList<String> sourceFiles;
    private ArrayList<String> classFiles;


    public Project(){
        activity = 0;
        collaborators = new ArrayList<String>();
        labels = new ArrayList<String>();
        languages = new ArrayList<String>();
        repositoryHistory = new ArrayList<Object>();
        repositoryType = -1;
        name = "";
        description="";
        url = "";
        forge = "";
        sourceFiles = null;
        classFiles = null;
    }

    public String printToString() {
        String projectData = "\nName: "+name+";";
        projectData += "\nDescription: "+description+";";
        projectData += "\nLanguages: ";
        for(int i = 0;i<languages.size();i++){
            projectData+=languages.get(i)+",";
        }
        projectData += "\nCollaborators: ";
        for(int i = 0;i<collaborators.size();i++){
            projectData+=collaborators.get(i)+",";
        }
        projectData += "\nLabels: ";
        for(int i = 0;i<labels.size();i++){
            projectData+=labels.get(i)+",";
        }
        projectData += ";";
        return projectData;

    }

    public ArrayList<String> getCollaborators() {
        return collaborators;
    }

    public void addCollaboratorIfNew(String c){
        if(!collaborators.contains(c)){
            collaborators.add(c);
        }
    }

    public void addLabel(String l){
        labels.add(l.toLowerCase());
    }

    public String getDescription() {
        return description;
    }

    public ArrayList<String> getLanguages() {
        return languages;
    }


    public boolean isOfLanguage(String lang) {
        boolean result = false;
        for(int i = 0;i<this.languages.size();i++){
            if(languages.get(i).contains(lang)){
                result = true;
            }
        }
        return result;
    }

    public String getName() {
        return name;
    }

    public void setDescription(String description) {
        this.description = description.toLowerCase();
    }

    public void addLanguage(String language) {
        this.languages.add(language.toLowerCase());
    }

    public void setName(String name) {
        this.name = name.toLowerCase();
        byteDirectory = Globals.DATA_DIRECTORY+"/"+name+"/"+Globals.BYTECODE_DIRECTORY;
        sourceDirectory = Globals.DATA_DIRECTORY+"/"+name+"/"+Globals.SOURCECODE_DIRECTORY;
    }

    public String getForge() {
        return forge;
    }

    public void setForge(String forge) {
        this.forge = forge.toLowerCase();
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public ArrayList<String> getLabels(){
        return this.labels;
    }

    public int getActivity() {
        return activity;
    }

    public void setActivity(int activity) {
        this.activity = activity;
    }

    public int getNoOfClasses() {
        return noOfClasses;
    }

    public void setNoOfClasses(int noOfClasses) {
        this.noOfClasses = noOfClasses;
    }

    public ProjectPackage getFirstCodePackage() {
        return firstCodePackage;
    }

    public void setFirstCodePackage(ProjectPackage firstCodePackage) {
        this.firstCodePackage = firstCodePackage;
    }

    public String getByteDirectory() {
        return byteDirectory;
    }

    public void setByteDirectory(String byteDirectory) {
        this.byteDirectory = byteDirectory;
    }

    public String getSourceDirectory() {
        return sourceDirectory;
    }

    public void setSourceDirectory(String sourceDirectory) {
        this.sourceDirectory = sourceDirectory;
    }

    public ArrayList getRepositoryHistory() {
        return repositoryHistory;
    }

    public void setRepositoryHistory(ArrayList repositoryHistory) {
        this.repositoryHistory = repositoryHistory;
    }

    public int getRepositoryType() {
        return repositoryType;
    }

    public void setRepositoryType(int repositoryType) {
        this.repositoryType = repositoryType;
    }

    void setSources(ArrayList<String> sf) {
        this.sourceFiles = sf;
    }

    void setClasses(ArrayList<String> cf) {
        this.classFiles = cf;
    }

    public ArrayList<String> getClassFiles() {
        return classFiles;
    }

    public ArrayList<String> getSourceFiles() {
        return sourceFiles;
    }


    

}
